ItemsSourceBase
Represents the base implementation for an items source containing values of type .
Реализует: IItemsSource<T>, IItemsSource
Конструкторы
public ItemsSourceBase(bool excludeObsolete, ListSortDirection? sortOrder, Func<IItemsSourceItem, bool> filter, Func<T, string> getName, Func<T, string> getDescription)
itemsSourceBase = ItemsSourceBase(excludeObsolete, sortOrder, filter, getName, getDescription)
Initializes a new instance of the ItemsSourceBase class.
- excludeObsolete
- A value indicating whether obsolete items should be excluded.
- sortOrder
- The sort order for the items.
- filter
- A filter function to apply on items.
- getName
- A function to retrieve the display name from a value.
- getDescription
- A function to retrieve the description from a value.
public ItemsSourceBase(IEnumerable values, bool excludeObsolete, ListSortDirection? sortOrder, Func<IItemsSourceItem, bool> filter, Func<T, string> getName, Func<T, string> getDescription)
itemsSourceBase = ItemsSourceBase(values, excludeObsolete, sortOrder, filter, getName, getDescription)
Initializes a new instance of the ItemsSourceBase class using the specified values.
- values
- The collection of values or items.
- excludeObsolete
- A value indicating whether obsolete items should be excluded.
- sortOrder
- The sort order for the items.
- filter
- A filter function to apply on items.
- getName
- A function to retrieve the display name from a value.
- getDescription
- A function to retrieve the description from a value.
public ItemsSourceBase(IEnumerable values, Func<T, string> getName, Func<T, string> getDescription)
itemsSourceBase = ItemsSourceBase(values, getName, getDescription)
Initializes a new instance of the ItemsSourceBase class using a collection of values.
- values
- The collection of values or items.
- getName
- A function to retrieve the display name from a value.
- getDescription
- A function to retrieve the description from a value.
public ItemsSourceBase()
itemsSourceBase = ItemsSourceBase()
Initializes a new instance of the ItemsSourceBase class.
Свойства
Ecng#ComponentModel#IItemsSource#Values
Gets the collection of items.
public bool ExcludeObsolete { get; }
value = itemsSourceBase.ExcludeObsolete
Gets a value indicating whether obsolete items should be excluded.
protected virtual string Format { get; }
value = itemsSourceBase.Format
Gets the format string for displaying the value. Override to provide a custom format.
public ListSortDirection? SortOrder { get; }
value = itemsSourceBase.SortOrder
Gets the sort order for sorting the items.
public IEnumerable<IItemsSourceItem<T>> Values { get; }
value = itemsSourceBase.Values
Gets the collection of strongly typed items.
public virtual Type ValueType { get; }
value = itemsSourceBase.ValueType
Gets the type of the value.
Методы
public virtual IItemsSourceItem<T> CreateNewItem(T value)
result = itemsSourceBase.CreateNewItem(value)
Creates a new item with the specified value.
- value
- The value for the new item.
Возвращает: The newly created item.
protected virtual bool Filter(IItemsSourceItem<T> item)
result = itemsSourceBase.Filter(item)
Applies filtering to the given item.
- item
- The item to filter.
Возвращает: true if the item should be included; otherwise, false.
protected virtual string GetDescription(T value)
result = itemsSourceBase.GetDescription(value)
Retrieves the description for the specified value.
- value
- The value whose description is to be retrieved.
Возвращает: The description.
protected virtual Uri GetIcon(T value)
result = itemsSourceBase.GetIcon(value)
Retrieves the icon for the specified value.
- value
- The value whose icon is to be retrieved.
Возвращает: The icon URI.
protected virtual bool GetIsObsolete(T value)
result = itemsSourceBase.GetIsObsolete(value)
Determines whether the specified value is marked as obsolete.
- value
- The value to check.
Возвращает: true if obsolete; otherwise, false.
protected virtual string GetName(T value)
result = itemsSourceBase.GetName(value)
Retrieves the display name for the specified value.
- value
- The value whose display name is to be retrieved.
Возвращает: The display name.
protected virtual IEnumerable<T> GetValues()
result = itemsSourceBase.GetValues()
Retrieves the underlying collection of values.
Возвращает: The collection of values.